package com.yuncheng.spcyApi.spcyService;

import org.apache.commons.collections.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yuncheng.spcyApi.constant.common.BusinessConstant;
import com.yuncheng.spcyApi.constant.common.ClientJumpUrlConstant;
import com.yuncheng.spcyApi.constant.common.SpcyConstant;
import com.yuncheng.spcyApi.entity.SpcySqsxWjjl;
import com.yuncheng.entity.YcSysUser;
import com.yuncheng.exception.BusinessException;
import com.yuncheng.spcyApi.service.ISpcyLogService;
import com.yuncheng.spcyApi.service.ISpcySqsxHymxService;
import com.yuncheng.spcyApi.service.ISpcySqsxWjjlService;
import com.yuncheng.spcyApi.service.IYcSysUserService;
import com.yuncheng.spcyApi.utils.GetCurrentUserUtils;
import com.yuncheng.spcyApi.utils.GetUuIdUtils;
import com.yuncheng.spcyApi.utils.LocalFileUploadUtils;

import com.yuncheng.vo.CurrentUserVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import utils.DateConversionUtils;
import utils.LogUtils;
import utils.ObjectToMapUtils;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 自定义minio文件记录上传
 */
@Component(value = "zdyUploadFileService")
public class ZdyUploadFileService {
    @Resource
    @Lazy
    private ISpcySqsxWjjlService spcySqsxWjjlService;

    @Resource
    @Lazy
    private IYcSysUserService sysUserService;

    @Resource
    @Lazy
    private ISpcyLogService spcyLogService;

    @Resource
    private ISpcySqsxHymxService spcySqsxHymxService;

    @Resource
    private LocalFileUploadUtils localFileUploadUtils;

    @Resource
    private ClientJumpUrlConstant clientJumpUrlConstant;

    /**
     * 构建附件路径
     * @param id
     * @return
     */
    public String genWjllHttpUrl(String id){
        if (StringUtils.isNotBlank(id)) {
            return clientJumpUrlConstant.zdyfjDownloadHttpsUrl + id;
        }else {
            return "";
        }
    }

    /**
     * 查询文件记录
     */
    public List<SpcySqsxWjjl> queryWjjlByPid(String pid, String logName){
        if (StringUtils.isBlank(pid)){
            return new ArrayList<>(1);
        }

        List<SpcySqsxWjjl> wjjlList = spcySqsxWjjlService.list(new LambdaQueryWrapper<SpcySqsxWjjl>()
                .eq(SpcySqsxWjjl::getFpid, pid)
                .eq(StringUtils.isNotBlank(logName), SpcySqsxWjjl::getFwjlx1, logName)
                .orderByAsc(SpcySqsxWjjl::getCreateTime));

        return wjjlList;
    }

    /**
     * 查询文件记录
     */
    public List<SpcySqsxWjjl> queryWjjlByPidNoOrder(String pid){
        if (StringUtils.isBlank(pid)){
            return new ArrayList<>(1);
        }

        List<SpcySqsxWjjl> wjjlList = spcySqsxWjjlService.list(new LambdaQueryWrapper<SpcySqsxWjjl>()
                .eq(SpcySqsxWjjl::getFpid, pid));

        return wjjlList;
    }

    /**
     * 查询文件记录
     */
    public List<SpcySqsxWjjl> queryWjjlByPid(String pid){
        if (StringUtils.isBlank(pid)){
            return new ArrayList<>(1);
        }

        List<SpcySqsxWjjl> wjjlList = spcySqsxWjjlService.list(new LambdaQueryWrapper<SpcySqsxWjjl>()
                .eq(SpcySqsxWjjl::getFpid, pid)
                .orderByAsc(SpcySqsxWjjl::getCreateTime));

        return wjjlList;
    }

    /** 查询文件记录 */
    public SpcySqsxWjjl queryWjjlById(String id){
        if (StringUtils.isEmpty(id)){
            throw new BusinessException("文件参数为空!");
        }
        SpcySqsxWjjl wjjl = spcySqsxWjjlService.getById(id);
        if (wjjl == null){
            throw new BusinessException("当前文件记录不存在!");
        }
        return wjjl;
    }

    /**
     * 上传文件-生成文件记录
     * @param uploadFile 文件
     * @param fpid 业务id
     * @param logName
     * @param ml
     */
    public void uploadFile(MultipartFile[] uploadFile, String fpid, String logName,String ml){
        this.uploadFile(uploadFile,fpid,logName,ml,null);
    }

    /**
     * 多文件上传文件-生成文件记录
     * @param uploadFile 文件流
     * @param fpid 业务id
     * @param logName 日志名称
     * @param ml 目录 xxx、xxx/xxx
     * @param fileid 自定义文件id
     */
    public void uploadFile(MultipartFile[] uploadFile, String fpid, String logName,String ml,String fileid){
        if (StringUtils.isBlank(fpid)){
            throw new BusinessException("业务参数为空！");
        }

        if (uploadFile == null || uploadFile.length == 0) {
            throw new BusinessException("上传失败,请先选择文件！");
        }

        for (MultipartFile file : uploadFile) {

            String originalFilename = file.getOriginalFilename();
            // 文件类型
            String wjlx = originalFilename.substring(originalFilename.lastIndexOf("."));

            // 文件名
            String fileName = originalFilename.substring(0, file.getOriginalFilename().lastIndexOf("."));

            String sjmc = GetUuIdUtils.ReplaceUuId();
            String wjccmc = sjmc + wjlx;

            localFileUploadUtils.uploadZdyFile(file, wjccmc, ml, localFileUploadUtils.isEnableMinioWjjlFile()); // 上传文件

            if (StringUtils.isBlank(fileid)) {
                fileid = GetUuIdUtils.NotReplaceUuId();
            }
            SpcySqsxWjjl spcySqsxWjjl = new SpcySqsxWjjl();
            spcySqsxWjjl.setId(fileid);
            spcySqsxWjjl.setFpid(fpid);
            spcySqsxWjjl.setFwjlx(wjlx);
            spcySqsxWjjl.setFwjlx1(logName);
            spcySqsxWjjl.setFwjxsmc(fileName);
            spcySqsxWjjl.setFwjccmc(wjccmc);
            String cflj = "/" + ml + "/" + wjccmc;
            spcySqsxWjjl.setFcflj(cflj);
            boolean flag = spcySqsxWjjlService.save(spcySqsxWjjl);
            if (flag) {
                String czContent = "上传"+logName+"文件: ";
                Map<String, Object> wjjlMap = ObjectToMapUtils.objectToMap(spcySqsxWjjl);
                czContent += LogUtils.MapToStringMethod(wjjlMap);
                spcyLogService.addLogs(logName, czContent, fileid, "上传文件", SpcyConstant.LOGS_SYS_TYPE_TJ);
            }
        }
    }

    /**
     * 单文件-上传文件-生成文件记录
     * @param file 文件流
     * @param fpid 业务id
     * @param logName 日志名称
     * @param ml 目录 xxx、xxx/xxx
     * @param fileid 自定义文件id
     */
    public SpcySqsxWjjl uploadFile(MultipartFile file, String fpid, String logName,String ml,String fileid){
        if (StringUtils.isBlank(fpid)){
            throw new BusinessException("业务参数为空！");
        }

        String originalFilename = file.getOriginalFilename();
        // 文件类型
        String wjlx = originalFilename.substring(originalFilename.lastIndexOf("."));

        // 文件名
        String fileName = originalFilename.substring(0, file.getOriginalFilename().lastIndexOf("."));

        String sjmc = GetUuIdUtils.ReplaceUuId();
        String wjccmc = sjmc + wjlx;

        localFileUploadUtils.uploadZdyFile(file, wjccmc, ml, true); // 上传文件

        if (StringUtils.isBlank(fileid)) {
            fileid = GetUuIdUtils.NotReplaceUuId();
        }
        SpcySqsxWjjl spcySqsxWjjl = new SpcySqsxWjjl();
        spcySqsxWjjl.setId(fileid);
        spcySqsxWjjl.setFpid(fpid);
        spcySqsxWjjl.setFwjlx(wjlx);
        spcySqsxWjjl.setFwjlx1(logName);
        spcySqsxWjjl.setFwjxsmc(fileName);
        spcySqsxWjjl.setFwjccmc(wjccmc);
        String cflj = "/" + ml + "/" + wjccmc;
        spcySqsxWjjl.setFcflj(cflj);
        spcySqsxWjjlService.save(spcySqsxWjjl);

        return spcySqsxWjjl;
    }

    /**
     * 下载文件-通过文件记录
     * @param fileId 文件记录id
     * @param response
     */
    public void downloadFile(String fileId, HttpServletResponse response){
        if (StringUtils.isEmpty(fileId)){
            response.setContentType("text/html");
            response.setCharacterEncoding("UTF-8");
            PrintWriter writer = null;
            try {
                writer = response.getWriter();
            } catch (IOException e) {
                e.printStackTrace();
            }
            writer.println("参数为空！");
            writer.close(); // 不要忘记关闭PrintWriter
            return;
        }

        SpcySqsxWjjl wjjl = spcySqsxWjjlService.getById(fileId);
        if (wjjl == null){
            response.setContentType("text/html");
            response.setCharacterEncoding("UTF-8");
            PrintWriter writer = null;
            try {
                writer = response.getWriter();
            } catch (IOException e) {
                e.printStackTrace();
            }
            writer.println("没有相匹配的文件记录！");
            writer.close(); // 不要忘记关闭PrintWriter
            return;
        }

        if (StringUtils.isBlank(wjjl.getFcflj())){
            response.setContentType("text/html");
            response.setCharacterEncoding("UTF-8");
            PrintWriter writer = null;
            try {
                writer = response.getWriter();
            } catch (IOException e) {
                e.printStackTrace();
            }
            writer.println("没有相关附件！");
            writer.close(); // 不要忘记关闭PrintWriter
            return;
        }

        if (StringUtils.isNotBlank(wjjl.getFwjlx1()) && wjjl.getFwjlx1().equals(BusinessConstant.USER_QM)){
            localFileUploadUtils.ejzLocalQmFileURl(wjjl.getFcflj(), response);
        }else {

            localFileUploadUtils.ejzLocalFileURlByZdy(wjjl.getFcflj(), localFileUploadUtils.isEnableMinioWjjlFile(), response);
        }
    }

    /**
     * 下载文件-通过文件记录
     * @param wjjl 文件记录
     * @param response
     */
    public void downloadFile(SpcySqsxWjjl wjjl, HttpServletResponse response){
        if (wjjl == null){
            throw new BusinessException("当前文件记录不存在!");
        }

        if (StringUtils.isBlank(wjjl.getFcflj())){
            throw new BusinessException("文件不存在!");
        }

//        localFileUploadUtils.ejzLocalFileURlByZdy(wjjl.getFcflj(),true,response);
        this.downloadFile(wjjl, true, response);
    }

    public void downloadFile(SpcySqsxWjjl wjjl, boolean isMinio, HttpServletResponse response){
        if (wjjl == null){
            throw new BusinessException("当前文件记录不存在!");
        }

        if (StringUtils.isBlank(wjjl.getFcflj())){
            throw new BusinessException("文件不存在!");
        }

        localFileUploadUtils.ejzLocalFileURlByZdy(wjjl.getFcflj(),isMinio,response);
    }

    /**
     * 删除文件-通过文件记录
     * @param fileId 文件记录id
     * @param logName 日志名称
     */
    public void deleteFile(String fileId,String logName){
        if (StringUtils.isEmpty(fileId)){
            throw new BusinessException("文件参数为空！");
        }

        SpcySqsxWjjl wjjl = spcySqsxWjjlService.getById(fileId);
        if (wjjl == null){
            throw new BusinessException("文件记录不存在！");
        }

        if (StringUtils.isBlank(logName)){
            logName = wjjl.getFwjlx1();
        }

        String pid = wjjl.getFpid();
        spcySqsxWjjlService.removeById(fileId);

        if (StringUtils.isNotBlank(wjjl.getFcflj())) {
            deleteFileByUrl(wjjl.getFcflj());
        }

        String czContent = "删除 "+logName+"文件: ";
        czContent += LogUtils.MapToStringMethod(ObjectToMapUtils.objectToMap(wjjl));
        spcyLogService.addLogs(logName,czContent,pid, "删除文件",SpcyConstant.LOGS_SYS_TYPE_SC);
    }

    /**
     * 批量删除文件-通过文件记录
     * @param id 业务id
     */
    public void deleteFileByBatch(String id){
        if (StringUtils.isBlank(id)){
            return;
        }

        // 删除文件
        List<SpcySqsxWjjl> wjjlList = spcySqsxWjjlService.list(new LambdaQueryWrapper<SpcySqsxWjjl>()
                .eq(SpcySqsxWjjl::getFpid, id));

        if (CollectionUtils.isEmpty(wjjlList)){
            return;
        }

        for (SpcySqsxWjjl wjjl : wjjlList) {
            deleteFileRecords(wjjl);
            deleteFileByUrl(wjjl.getFcflj());
        }
    }

    // 删除文件记录
    public void deleteFileRecords(SpcySqsxWjjl wjjl){
        spcySqsxWjjlService.removeById(wjjl.getId());

        String czContent = "删除 "+wjjl.getFwjlx1()+"文件: ";
        czContent += LogUtils.MapToStringMethod(ObjectToMapUtils.objectToMap(wjjl));
        spcyLogService.addLogs(wjjl.getFwjlx1(),czContent,wjjl.getFpid(), "删除文件",SpcyConstant.LOGS_SYS_TYPE_SC);
    }

    /**
     * 路径删除文件
     * @param fcflj 存放路径
     */
    public void deleteFileByUrl(String fcflj){
        deleteFileByUrl(fcflj, localFileUploadUtils.isEnableMinioWjjlFile());
    }
    public void deleteFileByUrl(String fcflj, boolean isMinio){
        if (StringUtils.isBlank(fcflj)){
            return;
        }
        localFileUploadUtils.deleteLocalFileUrlByZdy(fcflj, isMinio);
    }

    /**
     * 上传用户签名
     * @param userid 用户id
     */
    public void uploadMyQm(MultipartFile file, String userid){
        if (file.isEmpty()){
            throw new BusinessException("文件不能为空，请上传文件");
        }

        String username = "";
        if (StringUtils.isNotBlank(userid)){
            YcSysUser user = sysUserService.getUserJbxxById(userid);
            if (user != null){
                username = user.getRealname();
            }else {
                throw new BusinessException("没有相匹配的用户！");
            }
        }else {
            CurrentUserVo currentUser = GetCurrentUserUtils.getCurrentUser();
            if (currentUser == null){
                throw new BusinessException("登录已失效，请重新登录！");
            }

            userid = currentUser.getId();
            username = currentUser.getName();
        }

        String originalFilename = file.getOriginalFilename();
        // 文件类型
        String wjlx = originalFilename.substring(originalFilename.lastIndexOf("."));

        if (!wjlx.equals(".jpg") && !wjlx.equals(".png") && !wjlx.equals(".jpeg")){
            throw new BusinessException("请上传【JPG、PNG】图片格式的文件！");
        }

        String sjmc = username + GetUuIdUtils.ReplaceUuId();
        String wjccmc = sjmc + wjlx;
        String ml = DateConversionUtils.DateToYear(new Date());
        String cflj =  "/" + ml + "/" +wjccmc;

        localFileUploadUtils.uploadUserQmFile(file, wjccmc, ml); // 上传文件

        SpcySqsxWjjl wjjl = new SpcySqsxWjjl();
        wjjl.setId(GetUuIdUtils.ReplaceUuId());
        wjjl.setFpid(userid);
        wjjl.setFwjxsmc(username);
        wjjl.setFwjccmc(wjccmc);
        wjjl.setFcflj(cflj);
        wjjl.setFwjlx1(BusinessConstant.USER_QM); // 签名
        wjjl.setFwjlx(wjlx);

        String wjid = "";

        List<SpcySqsxWjjl> qmList = spcySqsxWjjlService.findUserQmList(userid);
        if (CollectionUtils.isEmpty(qmList)) {
            spcySqsxWjjlService.save(wjjl);
            wjid = wjjl.getId();
        }else {

            SpcySqsxWjjl wjjl1 = qmList.get(0);

            localFileUploadUtils.deleteLocalQmFile(wjjl1.getFcflj());

            wjjl1.setFwjxsmc(username);
            wjjl1.setFwjccmc(wjccmc);
            wjjl1.setFcflj(cflj);
            wjjl1.setFwjlx(wjlx);
            spcySqsxWjjlService.updateById(wjjl1);

            wjid = wjjl1.getId();
        }

        String signLink = clientJumpUrlConstant.zdyfjDownloadHttpsUrl + wjid;
        spcySqsxHymxService.updateHymxByUserid(userid, signLink);
    }

    /**
     * 上传用户照片
     * @param userid 用户id
     * */
    public void uploadMyPhoto(MultipartFile file, String userid){
        if (file.isEmpty()){
            throw new BusinessException("文件不能为空，请上传文件");
        }
        String username = "";
        if (StringUtils.isNotBlank(userid)){
            YcSysUser user = sysUserService.getUserJbxxById(userid);
            if (user != null){
                username = user.getRealname();
            }else {
                throw new BusinessException("没有相匹配的用户！");
            }
        }else {
            CurrentUserVo currentUser = GetCurrentUserUtils.getCurrentUser();
            if (currentUser == null) {
                throw new BusinessException("登录已失效，请重新登录！");
            }
            userid = currentUser.getId();
            username = currentUser.getName();
        }

        String originalFilename = file.getOriginalFilename();
        // 文件类型
        String wjlx = originalFilename.substring(originalFilename.lastIndexOf("."));

        if (!wjlx.equals(".jpg") && !wjlx.equals(".png") && !wjlx.equals(".jpeg")){
            throw new BusinessException("请上传【JPG、PNG】图片格式的文件！");
        }

        String sjmc = username + GetUuIdUtils.ReplaceUuId();
        String wjccmc = sjmc + wjlx;

        String ml = SpcyConstant.USER_PHOTO_FILE_BASE_URL + "/" + DateConversionUtils.DateToYear(new Date());
        localFileUploadUtils.uploadZdyFile(file, wjccmc, ml, localFileUploadUtils.isEnableMinioWjjlFile()); // 上传文件

        String cflj =  "/"+ ml + "/" + wjccmc;

        SpcySqsxWjjl wjjl = new SpcySqsxWjjl();
        wjjl.setId(GetUuIdUtils.ReplaceUuId());
        wjjl.setFpid(userid);
        wjjl.setFwjxsmc(username);
        wjjl.setFwjccmc(wjccmc);
        wjjl.setFcflj(cflj);
        wjjl.setFwjlx1(BusinessConstant.USER_PHOTO); // 照片
        wjjl.setFwjlx(wjlx);

        List<SpcySqsxWjjl> photoList = spcySqsxWjjlService.findUserPhotoList(userid);
        if (CollectionUtils.isEmpty(photoList)) {
            spcySqsxWjjlService.save(wjjl);
        }else {

            SpcySqsxWjjl wjjl1 = photoList.get(0);

            deleteFileByUrl(wjjl1.getFcflj());

            wjjl1.setFwjxsmc(username);
            wjjl1.setFwjccmc(wjccmc);
            wjjl1.setFcflj(cflj);
            wjjl1.setFwjlx(wjlx);
            spcySqsxWjjlService.updateById(wjjl1);
        }
    }

    /**
     * 上传检查员证件
     * @param userid 用户id
     * */
    public void uploadMyJcyZj(MultipartFile file, String userid){
        CurrentUserVo currentUser = GetCurrentUserUtils.getCurrentUser();
        if (currentUser == null){
            throw new BusinessException("登录已失效，请重新登录！");
        }

        if (file.isEmpty()){
            throw new BusinessException("文件不能为空，请上传文件");
        }
        String username = "";
        if (StringUtils.isNotBlank(userid)){
            YcSysUser user = sysUserService.getUserJbxxById(userid);
            if (user != null){
                username = user.getRealname();
            }else {
                throw new BusinessException("没有相匹配的用户！");
            }
        }else {
            userid = currentUser.getId();
            username = currentUser.getName();
        }

        String originalFilename = file.getOriginalFilename();
        // 文件类型
        String wjlx = originalFilename.substring(originalFilename.lastIndexOf("."));

        if (!wjlx.equals(".jpg") && !wjlx.equals(".png") && !wjlx.equals(".jpeg")){
            throw new BusinessException("请上传【JPG、PNG】图片格式的文件！");
        }

        String sjmc = username + GetUuIdUtils.ReplaceUuId();
        String wjccmc = sjmc + wjlx;

        String ml = SpcyConstant.USER_JCY_ZJ_FILE_BASE_URL + "/" + DateConversionUtils.DateToYear(new Date());
        localFileUploadUtils.uploadZdyFile(file, wjccmc, ml, localFileUploadUtils.isEnableMinioWjjlFile()); // 上传文件

        String cflj =  "/"+ ml + "/" + wjccmc;

        SpcySqsxWjjl wjjl = new SpcySqsxWjjl();
        wjjl.setId(GetUuIdUtils.ReplaceUuId());
        wjjl.setFpid(userid);
        wjjl.setFwjxsmc(username);
        wjjl.setFwjccmc(wjccmc);
        wjjl.setFcflj(cflj);
        wjjl.setFwjlx1(BusinessConstant.USER_JCY_ZJ); // 检查员证件
        wjjl.setFwjlx(wjlx);

        List<SpcySqsxWjjl> photoList = spcySqsxWjjlService.findUserJcyZjList(userid);
        if (CollectionUtils.isEmpty(photoList)) {
            spcySqsxWjjlService.save(wjjl);
        }else {

            SpcySqsxWjjl wjjl1 = photoList.get(0);

            deleteFileByUrl(wjjl1.getFcflj());

            wjjl1.setFwjxsmc(username);
            wjjl1.setFwjccmc(wjccmc);
            wjjl1.setFcflj(cflj);
            wjjl1.setFwjlx(wjlx);
            spcySqsxWjjlService.updateById(wjjl1);
        }
    }

    /**
     * 下载用户签名
     * @param userid 用户id
     */
    public void downMyQm(String userid, CurrentUserVo currentUser, HttpServletResponse response){
        SpcySqsxWjjl wjjl = spcySqsxWjjlService.downMyUserQm(userid, currentUser);
        if (wjjl == null){
            throw new BusinessException("不存在相关签名记录！");
        }
        if (StringUtils.isBlank(wjjl.getFcflj())){
            throw new BusinessException("签名附件路径为空！");
        }
        localFileUploadUtils.ejzLocalQmFileURl(wjjl.getFcflj(), response);
    }
    /**
     * 删除签名
     */
    public void deleteMyQm(String wjid, String userid){
        SpcySqsxWjjl wjjl = null;
        if (StringUtils.isNotBlank(userid)){
            wjjl = spcySqsxWjjlService.downMyUserQm(userid, null);
        }

        if (wjjl == null) {
            if (StringUtils.isBlank(wjid)) {
                return;
            }

            wjjl = spcySqsxWjjlService.getById(wjid);
            if (wjid == null){
                return;
            }
        }

        if (StringUtils.isBlank(wjjl.getFcflj())){
            return;
        }

        spcySqsxWjjlService.removeById(wjjl.getId());

        localFileUploadUtils.deleteLocalQmFile(wjjl.getFcflj());
    }

    /**
     * 下载用户照片
     * @param userid
     * @param response
     */
    public void downMyPhoto(String userid, HttpServletResponse response){
        CurrentUserVo currentUser = GetCurrentUserUtils.getCurrentUser();
        SpcySqsxWjjl wjjl = spcySqsxWjjlService.downMyUserPhoto(userid, currentUser);
        if (wjjl == null){
            throw new BusinessException("不存在相关照片记录！");
        }
        if (StringUtils.isBlank(wjjl.getFcflj())){
            throw new BusinessException("照片附件路径为空！");
        }

        localFileUploadUtils.ejzLocalFileURlByZdy(wjjl.getFcflj(),localFileUploadUtils.isEnableMinioWjjlFile(),response);
    }

    /**
     * 下载检查员证件
     * @param userid
     * @param response
     */
    public void downMyJcyZj(String userid, HttpServletResponse response){
        CurrentUserVo currentUser = GetCurrentUserUtils.getCurrentUser();
        SpcySqsxWjjl wjjl = spcySqsxWjjlService.downMyUserJcyZj(userid, currentUser);
        if (wjjl == null){
            throw new BusinessException("不存在相关照片记录！");
        }
        if (StringUtils.isBlank(wjjl.getFcflj())){
            throw new BusinessException("照片附件路径为空！");
        }

        localFileUploadUtils.ejzLocalFileURlByZdy(wjjl.getFcflj(),localFileUploadUtils.isEnableMinioWjjlFile(),response);
    }
}
